/**
 * @projectName study_java
 * @package Observer
 * @className Observer.ConcreteObserver
 */
package Observer;

import lombok.Data;

/**
 * ConcreteObserver
 * @description 具体的订阅者
 * @author answer_wx
 * @date 2022/6/28 10:57
 * @version 1.0
 */
@Data
public class ConcreteObserver implements IObserver {
    private String name;
    private ConcreteSubject subject;

    public ConcreteObserver(String name, ConcreteSubject subject) {
        this.name = name;
        this.subject = subject;
    }

    @Override
    public void Update() {
        System.out.println(String.format("订阅者%s看到主题的状态：%s", name, subject.getSubjectState()));
    }
}